package com.dhh.util;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.text.InputType;
import android.view.Gravity;
import android.widget.EditText;
import android.widget.FrameLayout;

public class CompUtil {
	public static AlertDialog getAlertDialogTextEdit(String title,String defaultValue,Context context,final CUtilListener listener){
		final FrameLayout fl = new FrameLayout(context);
		final EditText input = new EditText(context);
		input.setGravity(Gravity.CENTER);
		fl.addView(input, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT));
		input.setText(defaultValue);
		input.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setView(fl).setTitle(title).
			setPositiveButton("OK", listener.getListener()).
		    setNegativeButton("Cancel", new DialogInterface.OnClickListener(){		    	 
                @Override
                public void onClick(DialogInterface d, int which) {
                	d.dismiss();
                }
        });
		return builder.create();
	}
}
